// 获取用户登录状态
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const res = await db.collection('users').where({open_id:event.open_id}).get() // 直接执行数据库操作
	if (res.affectedDocs === 0) {
		return { code: 403, msg: "用户不存在, 请授权" }
	} else {
		if (res.data[0].status) {
			return { data: res, code: 200, msg: "ok" }
		} else {
			return { data: res, code: 208, msg: '联系管理员放权' }
		}
	}
	
};
